package com.zjy.software.day15;

import com.zjy.software.day14.MyRunnableImple;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class ExecutorTest {
    public static void main(String[] args){
        //创建一个单线程的线程池
        ExecutorService executor= Executors.newSingleThreadExecutor();

        //创建一个固定大小的线程池
        ExecutorService executor1= Executors.newFixedThreadPool(5);

        //创建一个可缓存的线程池
        ExecutorService executor2= Executors.newCachedThreadPool();

        //给线程池提交要执行的线程
       executor.submit(new MyRunnableImple());


        executor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("我是要提交到线程池里面的匿名类的线程实现 --------hello");
            }
        });

        executor.shutdown();
}
}
